//
//  CancelTaskHeaderView.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/8/20.
//

#import "CancelTaskHeaderView.h"
#import "TemplateFoundDetailsModel.h"

@interface CancelTaskHeaderView ()

@property (nonatomic ,strong) UIView * backview;
@property (nonatomic ,strong) UILabel * nameLab;
@property (nonatomic ,strong) UILabel * executeTime;
@property (nonatomic ,strong) UILabel * tissueName;
@property (nonatomic ,strong) UILabel * Description;
@property (nonatomic ,strong) UILabel * templab;
@property (nonatomic ,strong) UILabel * appointorName;

@end
@implementation CancelTaskHeaderView


+ (instancetype)NewView {
    CancelTaskHeaderView * view = [CancelTaskHeaderView new];
    view.clipsToBounds = YES;
    [view newUI];
    return view;
}
- (void)newUI{
    
    MJWeakSelf
    UIView * backview = [UIView new];
    self.backview = backview;
    [self addSubview:backview];
    backview.backgroundColor = UIColor.whiteColor;
    [DTKTool YJ:kwt(5) andView:backview];
    [backview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(kwt(8));
        make.right.offset(kwt(-8));
    }];
    
    UILabel * nameLab = [DTKTool labelWithText:@"-" andFont:kCFont(19) andTextColor:KcolorHex(@"#222222")];
    self.nameLab = nameLab;
    [backview addSubview:nameLab];
    [nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(12));
        make.top.offset(kwt(14));
    }];
    
    UIImageView * leftimg = kimageView(@"time");
    [backview addSubview:leftimg];
    [leftimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(13));
        make.top.offset(kwt(48));
    }];
    
    
    UILabel * executeTime = [DTKTool labelWithText:@"-" andFont:kCFont(17) andTextColor:KcolorHex(@"#0967FF")];
    self.executeTime = executeTime;
    [backview addSubview:executeTime];
    [executeTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(36));
        make.right.offset(kwt(-10));
        make.centerY.equalTo(leftimg);
    }];
    
    UIView * line = [UIView new];
    line.backgroundColor = KcolorHex(@"#DBDBDB");
    [backview addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(12));
        make.right.offset(kwt(-12));
        make.top.offset(kwt(74));
        make.height.offset(0.5);
    }];
    
    UILabel * tissueName = [DTKTool labelWithText:@"-" andFont:kCFont(16) andTextColor:KcolorHex(@"#222222")];
    self.tissueName = tissueName;
    tissueName.numberOfLines = 0;
    [backview addSubview:tissueName];
    [tissueName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(12));
        make.right.offset(kwt(-12));
        make.top.offset(kwt(85));
    }];
    
    UILabel * Description = [DTKTool labelWithText:@"-" andFont:kFont(16) andTextColor:KcolorHex(@"#787A79")];
    self.Description = Description;
    Description.numberOfLines = 0;
    [backview addSubview:Description];
    [Description mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(12));
        make.width.offset(kwt(335));
        make.top.equalTo(tissueName.mas_bottom).offset(kwt(9));
    }];
    
    UILabel * appointorName = [DTKTool labelWithText:@"-" andFont:kCFont(16) andTextColor:KcolorHex(@"#222222")];
    self.appointorName = appointorName;
    appointorName.numberOfLines = 0;
    [backview addSubview:appointorName];
    [appointorName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(12));
        make.width.offset(kwt(335));
        make.top.equalTo(Description.mas_bottom).offset(kwt(10));
    }];
    
    UIView * buttomview = [UIView new];
    buttomview.backgroundColor = UIColor.whiteColor;
    [self addSubview:buttomview];
    [DTKTool BFYJ:kwt(10) andView:buttomview andCorner:UIRectCornerTopLeft|UIRectCornerTopRight andSize:CGRectMake(0,0,SCREEN_WIDTH, kwt(50))];
    [buttomview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.offset(0);
        make.height.offset(kwt(50));
        make.top.equalTo(backview.mas_bottom).offset(kwt(8));
    }];
    
    UILabel * templab = [DTKTool labelWithText:@"取消内容" andFont:kFont(19) andTextColor:KcolorHex(@"#222222")];
    [buttomview addSubview:templab];
    self.templab = templab;
    [templab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(kwt(15));
        make.height.offset(kwt(20));
        make.left.offset(kwt(12));
    }];
  
    
}
- (void)setNameStr:(NSString *)nameStr{
    self.templab.text = nameStr;
}
- (void)setModel:(ClockModel *)model{
    _model = model;
    self.nameLab.text = model.name;
    self.executeTime.text = model.executeTime;
//    NSString * pondname = @"";
//    NSMutableArray * pondArray = [NSMutableArray array];
//    for (pondModelListModel * pond in model.tissueName,model.pondModelList) {
//        [pondArray addObject:pond.name];
//    }
//    pondname = [pondArray componentsJoinedByString:@","];
    self.tissueName.text = self.model.tissueNameStr;
    self.Description.text = [NSString stringWithFormat:@"任务说明: %@", model.Description];
    self.appointorName.text = model.appointorNameStr;

    [self.backview mas_updateConstraints:^(MASConstraintMaker *make) {
        make.bottom.offset(kwt(-58));
    }];
  
}

@end
